#include"com.h"

int main()
{
  key_t key = ftok(PATHNAME, PROJ_ID);
  if(key<0)
  {
    perror("ftok failed!!!\n");
    return 1;
  }
  int shm = shmget(key, SIZE,IPC_CREAT);
  if(shm<0)
  {
    perror("shmget failed!!!\n");
    return 2;
  }

  char* mem = shmat(shm, NULL,0);//关联共享内存
  int i=0;
  while(1)
  {
    mem[i]='A'+i;
    i++;
    mem[i]='\0';
    sleep(1);
  }
  shmdt(mem);//共享内存去关联
  return 0;
}
